﻿/*
 *  Author: Louis A. Leskoviansky
 *  Company: Artemis Solutions Group (http://www.artemis-solutions.com)
 */


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Compilation;

namespace AjaxControlFramework.Compilation
{
    [AttributeUsage(AttributeTargets.Assembly)]
    public class CompiledJsxScriptAttribute : Attribute
    {
        //------// Properties \\--------------------------------------------\\
        public string Inherits { get; set; }
        public string ScriptName { get; set; }
        public ScriptType ScriptType { get; set; }
        public bool Singleton { get; set; }
        public string Language { get; set; }
        public string FileName { get; set; }
        //------\\ Properties //--------------------------------------------//



        //------// Constructors \\------------------------------------------\\
        public CompiledJsxScriptAttribute()
        {
            using (System.IO.StreamWriter writer = System.IO.File.CreateText("C:\\CompiledJsxScriptAttribute.txt"))
            {
                writer.Write("Success!");
            }

            if (!JsxScriptRegistry.Contains(this.FileName))
            {
                JsxScriptRegistry.Add(new JsxScript() {
                    FileName = this.FileName,
                    Inherits = this.Inherits,
                    Language = this.Language,
                    ScriptName = this.ScriptName,
                    ScriptType = this.ScriptType,
                    Singleton = this.Singleton
                });
            }
        }

        public CompiledJsxScriptAttribute(string fileName, string inherits, string language, string scriptName, ScriptType scriptType, bool singleton)
        {
            using (System.IO.StreamWriter writer = System.IO.File.CreateText("C:\\CompiledJsxScriptAttribute.txt"))
            {
                writer.Write("Success!");
            }

            if (!JsxScriptRegistry.Contains(fileName))
            {
                JsxScriptRegistry.Add(new JsxScript() {
                    FileName = fileName,
                    Inherits = inherits,
                    Language = language,
                    ScriptName = scriptName,
                    ScriptType = scriptType,
                    Singleton = singleton
                });
            }
        }
        //------\\ Constructors //------------------------------------------//



        //------// Methods \\-----------------------------------------------\\

        //------\\ Methods //-----------------------------------------------//
    }
}
